package br.ucb.sigplan.action.impl;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import br.ucb.sigplan.action.Action;
import br.ucb.sigplan.beans.Calendario;
import br.ucb.sigplan.crud.CalendarioCrud;

public class AbrirListaFeriadosAction implements Action {

	@Override
	public String execute(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		List<Calendario> dias = CalendarioCrud.findDatas('f');
		if (dias.isEmpty()) {
			req.setAttribute("msg", "feriadosVazio");
			return "/jsp/index.jsp";
		}
		req.setAttribute("feriados", dias);
		return "/jsp/diretor/calendario/dirListaFeriados.jsp";
	}

}
